package com.qf.controller;


import com.qf.pojo.Car;
import com.qf.service.CarService;
import com.qf.util.Basedata;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/car")
public class Carcontroller {

    @Autowired
    CarService carService;

    @RequestMapping("/carsPrice")
    public Basedata selectCarByCity(Integer getid){
        List<Car> cars = carService.selectCarByCity(getid);

        return new Basedata(1,cars);
    }

    @RequestMapping("/carNum")
    public Basedata selectCarByCityNum(Integer getid){
        List<Car> cars = carService.selectCarByCityNum(getid);

        return new Basedata(1,cars);
    }

    @RequestMapping("/carMessage")
    public Basedata carMessage(Integer cid){
        Car car = carService.carMessage(cid);
        return new Basedata(1,car);
    }
}
